# https://ssr1.scrape.center/
import requests
import re
from bs4 import BeautifulSoup


def get_data():
    url = f'http://glidedsky.com/level/web/crawler-basic-1'
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/101.0.0.0 Safari/537.36",
        "Cookie": "XSRF-TOKEN=eyJpdiI6IkRjQUN5Z25CcmI4T2xUQStXcW9Yb1E9PSIsInZhbHVlIjoidDNHZWswNVZHS1E1VE5qYUdUYkkwbzB0aFVqUWo3cHdzUldrUzAyTXNDTyt2VWU2R1hScFlQaVhKdXBcLzFOc0UiLCJtYWMiOiIyNTM0Yjc2YzFiMTA4YzU1YjM1MjkyZGU0MTM1YzNmZmQ0Nzc0ZDI3MTM5MWZlMGQ3ZTM1ZTQwOGFhY2Y4NDdlIn0%3D; expires=Sun, 26-Jun-2022 10:49:32 GMT; Max-Age=7200; path=/;glidedsky_session=eyJpdiI6InJRZ2xcL0V0T0FqcVVxT0Q1d2VLenR3PT0iLCJ2YWx1ZSI6IlhWMnRXXC9PcUlaOHdIOEdkcmN4ZmNFR240WEozaGgzQzBKaGNtYVZWWXBoekh6TTdsZ1ZpbXVaSDV6bWdjaVZZIiwibWFjIjoiNTUwMTVlM2I1MGViNWNmOGM1MTRlMWRmMzMzM2I0NDE1MTlmMTkyNzQ0MmU1ZTlhOWYwZGQ0MWNiMTEwNmEyZCJ9; expires=Sun, 26-Jun-2022 10:49:32 GMT; Max-Age=7200; path=/; httponly;",
    }
    content = requests.get(url, headers=headers).text
    bs4_data = BeautifulSoup(content, "lxml")
    v_list = bs4_data.select('.card-body .col-md-1')
    return [int(re.sub(r"[\s]", '', v_el.text)) for v_el in v_list]


def main():
    res = get_data()
    print(res)
    print(sum(res))


if __name__ == '__main__':
    main()
